//
//  ActivetyDataViewController.m
//  UI - 豆瓣
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "ActivetyDataViewController.h"
#import "AppTools.h"


@interface ActivetyDataViewController ()
@property(nonatomic, retain) UIImageView *imageView;
@property(nonatomic, retain) UIImageView *imageView1;
@property(nonatomic, retain) UIImageView *imageView2;
@property(nonatomic, retain) UIImageView *imageView3;
@property(nonatomic, retain) UIImageView *imageView4;
@property(nonatomic, retain) UILabel *lable1;
@property(nonatomic, retain)UIScrollView *scroView;

@end

@implementation ActivetyDataViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.scroView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.view addSubview:self.scroView];
    self.view.backgroundColor = [UIColor whiteColor];
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 70, 125, 177)];
    [AppTools getWithName:self.activety.image block:^(NSData *data1) {
        self.imageView.image = [UIImage imageWithData:data1];
        
    }];
    [self.scroView addSubview:self.imageView];
    [self.imageView release];
    
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, 375, 40)];
    _lable1.text = self.activety.title;
    _lable1.numberOfLines = 0;
    _lable1.font = [UIFont systemFontOfSize:20];
    [self.scroView addSubview:_lable1];
    [_lable1 sizeToFit];
    [_lable1 release];
    
    
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(170, 130, 60, 15)];
    _lable1.text = @"类型：";
    _lable1.font = [UIFont fontWithName:@"Papyrus" size:15];
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    self.imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(145, 65, 15, 15)];
    [self.imageView1 setImage:[UIImage imageNamed:@"icon_date_blue.png"]];
    [self.scroView addSubview:self.imageView1];
    [self.imageView1 release];
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(170, 65, 100, 15)];
    _lable1.text = [self.activety.begin_time substringWithRange:NSMakeRange(5, 11)];
    _lable1.font = [UIFont systemFontOfSize:15];
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(260, 65, 40, 15)];
    _lable1.text = @"--";
    _lable1.font = [UIFont systemFontOfSize:15];
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(275, 65, 100, 15)];
    _lable1.text = [self.activety.end_time substringWithRange:NSMakeRange(5, 11)];
    _lable1.font = [UIFont systemFontOfSize:15];
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(170, 100, 215, 15)];
    _lable1.font = [UIFont systemFontOfSize:15];
   NSString *str = [self.activety.owner objectForKey:@"name"];
    _lable1.text = str;
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    self.imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(145, 100, 15, 15)];
    [self.imageView2 setImage:[UIImage imageNamed:@"icon_sponsor_blue.png"]];
    [self.scroView addSubview:self.imageView2];
    [self.imageView2 release];
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(215, 127.5, 60, 15)];
    _lable1.text = self.activety.category_name;
    _lable1.font = [UIFont systemFontOfSize:15];
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    self.imageView3 = [[UIImageView alloc] initWithFrame:CGRectMake(145, 130, 15, 15)];
    [self.imageView3 setImage:[UIImage imageNamed:@"icon_catalog_blue.png"]];
    [self.scroView addSubview:self.imageView3];
    [self.imageView3 release];
    
    self.imageView4 = [[UIImageView alloc] initWithFrame:CGRectMake(145, 160, 15, 15)];
    [self.imageView4 setImage:[UIImage imageNamed:@"icon_spot_blue.png"]];
    [self.scroView addSubview:self.imageView4];
    [self.imageView4 release];
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(170, 155, 210, 40)];
    _lable1.text = self.activety.address;
    _lable1.font = [UIFont systemFontOfSize:15];
    _lable1.numberOfLines = 0;
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(10, 260, 215, 25)];
    _lable1.text = @"活动介绍";
    _lable1.font = [UIFont systemFontOfSize:25];
    [self.scroView addSubview:_lable1];
    [_lable1 release];
    
    
    _lable1 = [[UILabel alloc] initWithFrame:CGRectMake(10, 300, 350, 260)];
    _lable1.text = self.activety.content;
    _lable1.font = [UIFont systemFontOfSize:14];
    _lable1.numberOfLines = 0;
    [_lable1 sizeToFit];
    CGFloat height = _lable1.frame.origin.y + self.lable1.frame.size.height + 115;
    self.scroView.contentSize = CGSizeMake(0, height);
    self.scroView.showsVerticalScrollIndicator = NO;
//    self.scroView.bounces = NO;
    [self.scroView addSubview:_lable1];
    [_lable1 release];

    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"btn_nav_share.png"] style:UIBarButtonItemStyleDone target:self action:@selector(rightAction:)];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"btn_nav_back.png"] style:UIBarButtonItemStyleDone target:self action:@selector(leftAction:)];
    
    
    
}
- (void)leftAction: (UIBarButtonItem *)left{
    
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)rightAction: (UIBarButtonItem *)right{
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
